package cn.laixueit.config;

import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil;
import cn.laixueit.po.TbBook;
import com.mybatisflex.annotation.InsertListener;

/**
 * @author duxiang
 * @date 2024/2/21 14:03
 */
public class BookInsertListener implements InsertListener {
    @Override
    public void onInsert(Object o) {
        TbBook tbBook = (TbBook) o;
        if(StrUtil.isBlank(tbBook.getCreateUser())){
            tbBook.setCreateUser("system");
        }
        if(ObjUtil.isEmpty(tbBook.getIsDelete())){
            tbBook.setIsDelete(false);
        }
    }
}
